<?php/*  PHP version 5  Copyright (c) 2002-2019ECISP.CN、EarcLink.COM  警告：这不是一个免费的软件，请在许可范围内使用，请尊重知识产权，侵权必究，举报有奖  作者：黄祥云 E-mail:6326420@qq.com  QQ:6326420 TEL:18665655030 / 13797552220*/


use application\ESPCMS_Core;
use modul_application\ESPCMS_Orderasyn;

class MainLoad {

	public static function in_Portal() {
		global $espcms_web_templates;
		$order_app_config = ESPCMS_Core::get_app_config('order', false);
		if (is_array($_POST) && count($_POST) > 5 && $_POST['trade_status'] == 'TRADE_SUCCESS' && $_POST['extra_common_param'] && $order_app_config['isetup'] && $order_app_config['isopen']) {
			$extra_common_param = $_POST['extra_common_param'] ? explode('|', $_POST['extra_common_param']) : array();
			if ($extra_common_param[0] && $extra_common_param[1]) {
				ESPCMS_Orderasyn::$extra_common_param[0]($extra_common_param[1], $_POST);
			}
		}
		$postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
		if ($postStr && $order_app_config['isetup'] && $order_app_config['isopen']) {
			libxml_disable_entity_loader(true);
			$postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
			if (!$postObj || $postObj->return_code != 'SUCCESS' || !$postObj->attach) {
				exit('SUCCESS');
			}
			$arr = (array) $postObj;
			$extra_common_param = $arr['attach'] ? explode('|', $arr['attach']) : array();
			if ($extra_common_param[0] && $extra_common_param[1]) {
				ESPCMS_Orderasyn::$extra_common_param[0]($extra_common_param[1], $arr, $postObj);
			}
		}
		$espcms_web_templates->into('path', 'index');
		$espcms_web_templates->output('index', 'index', false, false);
	}

}
